package com.teamone.etl.config;

import com.teamone.etl.interceptor.WebSpringRedisSessionInterceptor;
import javax.annotation.Resource;
import org.springframework.context.annotation.Bean;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Description
 * @Description 拦截器配置
 * @Author WangZhuoRan
 * @Email  2908540863@qq.com
 * @Create 2021-01-22 15:38
 * @Program star-etl
 */
public class WebSecurityConfig implements WebMvcConfigurer {

    @Bean
    public WebSpringRedisSessionInterceptor getUserSpringRedisSessionInterceptor() {
        return new WebSpringRedisSessionInterceptor();
    }

    @Resource
    private WebSpringRedisSessionInterceptor webSpringRedisSessionInterceptor;

    @Override
    public void addInterceptors (InterceptorRegistry registry) {
        registry.addInterceptor(webSpringRedisSessionInterceptor)
                .addPathPatterns("/**")
                .excludePathPatterns("classpath:/resources/**")
                .excludePathPatterns("/admin/systemsetting/loginUser","/userform/loginUser");
    }
}
